package observale;

import java.util.ArrayList;
import java.util.List;

public class RealSubject implements Subject {
    private List<Observer> mList = new ArrayList<>();

    @Override
    public void attach(Observer observer) {
        mList.add(observer);
    }

    @Override
    public void remove(Observer observer) {
        mList.remove(observer);
    }

    @Override
    public void notify(String msg) {
        mList.forEach(item -> item.updateMsg(msg));
    }
}
